import {defaultAxios as request } from '@/utils/http/index.js';
const api = "/api/tdengine/backupRecover/";

/**
 * 创建备份任务
 */
export function saveOrUpdateBackupTask(data,timeout=12000){
	return request({
    url: api + 'saveOrUpdateBackupTask',
    method: 'post',
    data,
    timeout: timeout 
  });
}

/**
 * 获取备份任务
 */
export function getBackupAndRecoverTask(data,timeout=12000){
	return request({
    url: api + 'getBackupAndRecoverTask',
    method: 'post',
    data,
    timeout: timeout 
  });
}

/**
 * 开启定时任务
 */
export function startTask(data,timeout=12000){
	return request({
    url: api + 'startTask',
    method: 'post',
    data,
    timeout: timeout 
  });
}

/**
 * 关闭定时任务
 */
export function stopTask(data,timeout=12000){
	return request({
    url: api + 'stopTask',
    method: 'get',
    params:data,
    timeout: timeout
  });
}

/**
 * 删除备份任务
 */
export function deleteTask(data,timeout=12000){
	return request({
    url: api + 'deleteTask',
    method: 'get',
    params: data,
    timeout: timeout
  });
}

/**
 * 获取全部任务日志信息
 */
export function getTaskLog(data,timeout=12000){
	return request({
    url: api + 'getTaskLog',
    method: 'post',
    data: data,
    timeout: timeout
  });
}

/**
 * 下载备份的测点数据
 */
export function downloadTagInfo(data,timeout=12000){
	return request({
    url: api + 'downloadTagInfo',
    method: 'get',
		responseType: 'blob',
    params: data,
    timeout: timeout
  });
}

/**
 * 获取正在执行的任务
 */
export function getRunningTask(data,timeout=12000){
	return request({
    url: api + 'getRunningTask',
    method: 'get',
    params: data,
    timeout: timeout
  });
}

/**
 * 获取正在执行任务日志
 */
export function getRunningTaskLog(data,timeout=12000){
	return request({
    url: api + 'getRunningTaskLog',
    method: 'get',
    params: data,
    timeout: timeout
  });
}